package com.mmall.concurrency.thread.one;

import java.util.*;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 功能描述：
 *
 * @author 吴明泽
 * @version 1.0
 * @date 2022-10-20 20:10:47
 */
public class Demo {

    public static void main(String[] args) throws InterruptedException {
//        Queue<String>  queue = new LinkedList<>();
//        final Producer producer = new Producer(queue, 10);
//        final Consumer consumer = new Consumer(queue, 10);
//        new Thread(producer).start();
//        Thread.sleep(100);
//        new Thread(consumer).start();

        Lock lock = new ReentrantLock();
        final Condition condition = lock.newCondition();

        final ConditionDemoWait wait = new ConditionDemoWait(lock, condition);
        final ConditionDemoNotify notify = new ConditionDemoNotify(lock, condition);
        new Thread(wait).start();
        new Thread(notify).start();

    }
}
